home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / misc1 / iv26_w30.zip / EXAMPLES / IDRAW / EDITOR.H < prev    next >
C/C++ Source or Header  |  1992-01-27  |  5KB  |  178 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. // $Header: editor.h,v 1.13 90/01/25 16:29:16 interran Exp $
  24. // declares class Editor.
  25.  
  26. #ifndef editor_h
  27. #define editor_h
  28.  
  29. #include <InterViews/defs.h>
  30.  
  31. // Declare imported types.
  32.  
  33. class ChangeNode;
  34. class Confirmer;
  35. class Drawing;
  36. class DrawingView;
  37. class Event;
  38. class Finder;
  39. class History;
  40. class IBrush;
  41. class IColor;
  42. class IFont;
  43. class IPattern;
  44. class Interactor;
  45. class Messager;
  46. class Namer;
  47. class NamerNUnit;
  48. class Painter;
  49. class RubberEllipse;
  50. class RubberLine;
  51. class RubberRect;
  52. class State;
  53.  
  54. // An Editor lets the user perform a drawing or editing operation on
  55. // a Drawing.
  56.  
  57. class Editor {
  58. public:
  59.  
  60.     Editor(Interactor*);
  61.     ~Editor();
  62.  
  63.     void SetDrawing(Drawing*);
  64.     void SetDrawingView(DrawingView*);
  65.     void SetState(State*);
  66.  
  67.     void HandleSelect(Event&);
  68.     void HandleMove(Event&);
  69.     void HandleScale(Event&);
  70.     void HandleStretch(Event&);
  71.     void HandleRotate(Event&);
  72.     void HandleReshape(Event&);
  73.     void HandleMagnify(Event&);
  74.     void HandleText(Event&);
  75.     void HandleLine(Event&);
  76.     void HandleMultiLine(Event&);
  77.     void HandleBSpline(Event&);
  78.     void HandleEllipse(Event&);
  79.     void HandleRect(Event&);
  80.     void HandlePolygon(Event&);
  81.     void HandleClosedBSpline(Event&);
  82.  
  83.     void New();
  84.     void Revert();
  85.     void Open(const char*);
  86.     void Open();
  87.     void Save();
  88.     void SaveAs();
  89.     void Print();
  90.     void Quit(Event&);
  91.     void Checkpoint();
  92.  
  93.     void Undo();
  94.     void Redo();
  95.     void Cut();
  96.     void Copy();
  97.     void Paste();
  98.     void Duplicate();
  99.     void Delete();
  100.     void SelectAll();
  101.     void FlipHorizontal();
  102.     void FlipVertical();
  103.     void _90Clockwise();
  104.     void _90CounterCW();
  105.     void PreciseMove();
  106.     void PreciseScale();
  107.     void PreciseRotate();
  108.  
  109.     void Group();
  110.     void Ungroup();
  111.     void BringToFront();
  112.     void SendToBack();
  113.     void NumberOfGraphics();
  114.  
  115.     void SetBrush(IBrush*);
  116.     void SetFgColor(IColor*);
  117.     void SetBgColor(IColor*);
  118.     void SetFont(IFont*);
  119.     void SetPattern(IPattern*);
  120.  
  121.     void AlignLeftSides();
  122.     void AlignRightSides();
  123.     void AlignBottoms();
  124.     void AlignTops();
  125.     void AlignVertCenters();
  126.     void AlignHorizCenters();
  127.     void AlignCenters();
  128.     void AlignLeftToRight();
  129.     void AlignRightToLeft();
  130.     void AlignBottomToTop();
  131.     void AlignTopToBottom();
  132.     void AlignToGrid();
  133.  
  134.     void Reduce();
  135.     void Enlarge();
  136.     void ReduceToFit();
  137.     void NormalSize();
  138.     void CenterPage();
  139.     void RedrawPage();
  140.     void GriddingOnOff();
  141.     void GridVisibleInvisible();
  142.     void GridSpacing();
  143.     void Orientation();
  144.     void ShowVersion();
  145.  
  146. protected:
  147.  
  148.     void Do(ChangeNode*);
  149.     void InputVertices(Event&, Coord*&, Coord*&, int&);
  150.     RubberLine* NewRubberLineOrAxis(Event&);
  151.     RubberEllipse* NewRubberEllipseOrCircle(Event&);
  152.     RubberRect* NewRubberRectOrSquare(Event&);
  153.     boolean OfferToSave();
  154.     void Reset(const char*);
  155.  
  156.     History* history;        // carries out and logs changes made to drawing
  157.     Messager* numberofdialog;    // displays how many graphics the drawing has
  158.     Finder* opendialog;        // prompts for name of a drawing to open
  159.     Confirmer* overwritedialog;    // confirms whether to overwrite a file
  160.     NamerNUnit* precmovedialog;    // prompts for X and Y movement
  161.     Namer* precrotdialog;    // prompts for rotation in degrees
  162.     Namer* precscaledialog;    // prompts for X and Y scaling
  163.     Namer* printdialog;        // prompts for print command
  164.     Messager* readonlydialog;    // tells user drawing is readonly
  165.     Confirmer* revertdialog;    // confirms whether to revert from a file
  166.     Finder* saveasdialog;    // prompts for name to save drawing as
  167.     Confirmer* savecurdialog;    // confirms whether to save current drawing
  168.     NamerNUnit* spacingdialog;    // prompts for grid spacing
  169.     Messager* versiondialog;    // displays idraw's version level and author
  170.  
  171.     Drawing* drawing;        // performs operations on drawing
  172.     DrawingView* drawingview;    // displays drawing
  173.     State* state;        // stores Graphic and nonGraphic attributes
  174.  
  175. };
  176.  
  177. #endif
  178.